<template>
  <div class="login-panel">
    <h1 class="login-panel-title">登录面板</h1>
    <el-tabs type="border-card" class="demo-tabs" stretch>
      <el-tab-pane>
        <template #label>
          <span class="custom-tabs-label">
            <el-icon><i-ep-calendar /></el-icon>
            <span>账号登录</span>
          </span>
        </template>
        <login-account ref="accountRef" />
      </el-tab-pane>
      <el-tab-pane label="手机登录">
        <login-phone ref="phoneRef" />
      </el-tab-pane>
    </el-tabs>
    <div class="account-control">
      <el-checkbox v-model="isKeepPassword">记住密码</el-checkbox>
      <el-link type="primary">忘记密码</el-link>
    </div>
    <el-button type="primary" class="login-panel-btn" @click="handleLoginClick">立即登录</el-button>
  </div>
</template>
<script setup lang="ts">
import loginAccount from './login-account.vue'
import loginPhone from './login-phone.vue'
import { ref } from 'vue'
const isKeepPassword = ref(false)
const accountRef = ref<InstanceType<typeof loginAccount>>()
const phoneRef = ref<InstanceType<typeof loginPhone>>()
const handleLoginClick = () => {
  accountRef.value?.loginAction(isKeepPassword.value)
  console.log('登录', accountRef)
}
</script>
<style lang="less">
.login-panel-title {
  text-align: center;
}
.account-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.login-panel-btn {
  width: 100%;
  margin-top: 10px;
}
</style>
